//只是为了统一过滤请求前还有请求后的数据
export default function RequestFilter(requestfun, vue) {
  let _this = vue
  //before

  //after

  return new Promise(
    (resolve) => {
      requestfun.then((rs) => {
        if (rs.data.code && rs.data.code == "50500") {


          _this.$cookie.delete('txy_name');
          _this.$cookie.delete('txy_token');
          _this.$emit('logout')


          if (_this.$route.path != '/page/login') {
            window.location.href = "/page/login"
            //window.location.reload();
          }
          return;
        }


        resolve(rs);
      })
    }
  );
}
